<?php
/**
 * Created by PhpStorm.
 * User: huynguyen
 * Date: 9/15/14
 * Time: 9:07 PM
 */

namespace Hdphim\Modules\Api\Models\Users;
use Phalcon\Mvc\Model;

class FailedLogins extends Model
{
    /**
     *
     * @var integer
     */
    protected $id;

    /**
     *
     * @var integer
     */
    protected $user_id;

    /**
     *
     * @var string
     */
    protected $ip_address;

    /**
     *
     * @var integer
     */
    protected $attempted;

    /**
     * Method to set the value of field id
     *
     * @param integer $id
     * @return $this
     */
    public function setId($id)
    {
        $this->id = $id;

        return $this;
    }

    /**
     * Method to set the value of field user_id
     *
     * @param integer $user_id
     * @return $this
     */
    public function setUserId($user_id)
    {
        $this->user_id = $user_id;

        return $this;
    }

    /**
     * Method to set the value of field ip_address
     *
     * @param string $ip_address
     * @return $this
     */
    public function setIpAddress($ip_address)
    {
        $this->ip_address = $ip_address;

        return $this;
    }

    /**
     * Method to set the value of field attempted
     *
     * @param integer $attempted
     * @return $this
     */
    public function setAttempted($attempted)
    {
        $this->attempted = $attempted;

        return $this;
    }

    /**
     * Returns the value of field id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Returns the value of field user_id
     *
     * @return integer
     */
    public function getUserId()
    {
        return $this->user_id;
    }

    /**
     * Returns the value of field ip_address
     *
     * @return string
     */
    public function getIpAddress()
    {
        return $this->ip_address;
    }

    /**
     * Returns the value of field attempted
     *
     * @return integer
     */
    public function getAttempted()
    {
        return $this->attempted;
    }

    public function getSource()
    {
        return 'users_failed_logins';
    }

    public function initialize()
    {
        $this->belongsTo('users_id' , 'Hdphim\Modules\Api\Models\Users\Users' , 'id' , array(
            'alias' => 'user'
        ));
    }
} 